package com.mingte.manghe.utils;

/**
 * @author ：luxinsheng
 * @Email ：282860642@qq.com
 * @date ：Created in 2021/11/25 18:11
 * @description：字符串工具类
 * @modified By：
 * @version: $
 */
public class StringUtils {

    /**
     * 验证字符串是否不为空
     * @param stringObj
     * @return
     */
    public static boolean isNotEmpty(String stringObj){
        if(null == stringObj || "".equals(stringObj)){
            return false;
        }
        return true;
    }

    /**
     * 验证字符串是否为空
     * @param stringObj
     * @return
     */
    public static boolean isEmpty(String stringObj){
        if(null == stringObj || "".equals(stringObj)){
            return true;
        }
        return false;
    }

    /**
     * 截取固定长度
     * @param origin
     * @param length
     * @return
     */
    public static String subStringForLength(String origin,int length){
        if(origin.length() > 1 && length >= 1){
            if(origin.length() > length){
                origin = origin.substring(0,(length));
            }
        }
        return origin;
    }

    /*public static void main(String[] args) {
        String str = subStringForLength("lkasjdklfjaklsdjfkljsadkfjk",10);
        System.out.println(str);
    }*/
}
